<meta http-equiv="refresh" content="30" />
<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/includes/config.inc.php');
include_once("config.php");
getConfig();
$CONFIG['enableRightColumn'] = true;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Today</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js/sexyalertbox.v1.2.jquery.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="css/sexyalertbox.css"/>
<script>
<!--
$(document).ready(function(){
  Sexy.initialize();
  <?php if(getPrinterInfo('192.168.11.158', 'toner') == '<b>Toner Level ~5%</b>'){ ?>
  	Sexy.error('Toner in Upstairs Registration is LOW!');
  <?php } ?>
  <?php if(getPrinterInfo('192.168.11.158', 'paper') != '<b>Paper Level - OK</b>'){ ?>
  	Sexy.error('Paper in Upstairs Registration is LOW!');
  <?php } ?>
  <?php if(getPrinterInfo('192.168.11.3', 'toner') == '<b>Toner Level ~5%</b>'){ ?>
  	Sexy.error('Toner in S-112 Registration is LOW!');
  <?php } ?>
  <?php if(getPrinterInfo('192.168.11.3', 'paper') != '<b>Paper Level - OK</b>'){ ?>
  	Sexy.error('Paper in S-112 Registration is LOW!');
  <?php } ?>
});
-->
</script>
<style>
body{
	background-image:none;
}
.box2, .box, .list2{
	background-color:#FFFFFF;
}
</style>
</head>
<body id="page1">
<div id="main-width">
  <div id="main">
    <!-- header -->
    <div id="header" class="png" style="height:60px;">
      <div class="row-2">
        <!-- menu-box begin -->
        <div class="menu-box" style="background-image:none">
          <div class="left"style="background-image:none">
            <div class="right"style="background-image:none">
              	  <?php if(date('d') == 15 or date('d') == 16 or date('d') == 30 or date('d') == 31 or date('d') == 1){ ?>
	              <div class="warning">
	              	Have you completed your time sheet yet?</a>
    	          </div>
                  <?php }elseif(checkLastSBuilding()){ ?>
                  <div class="error">
                  	It has been over 6 hours since the last S-Building report. It might be time to take a stroll on down there.
                  </div>
                  <?php }elseif(checkLastInventory()){ ?>
                  <?php if($CONFIG['enableInventoryReminder'] == 'true'){ ?>
                  <div class="error">
                  	It has been over 6 hours since the last annual inventory process. It might be time to do some inventory.
                  </div>
                  <?php }else{ ?>
                  <div class="info">
                  	No Notifications to Show Currently.
                  </div>
                  <?php } ?>
				  <?php }else{ ?>
                  <div class="info">
                  	No Notifications to Show Currently.
                  </div>
                  <?php } ?>
            </div>
          </div>
        </div>
        <!-- menu-box begin -->
      </div>
    </div>
    <!-- content -->
    <div id="content">
      <div class="wrapper">
        <div class="sidebar">
          <div class="indent">
            <div class="widget">
              <!-- box begin -->
              <div class="box alt">
                <div class="border-top">
                  <div class="border-right">
                    <div class="border-bot">
                      <div class="border-left">
                        <div class="left-top-corner">
                          <div class="right-top-corner">
                            <div class="right-bot-corner-1">
                              <div class="left-bot-corner-1">
                                <div class="inner" style="background-color:#FFF">
                                  <h3>Printer Status</h3>
                                  <div class="inner">
                                    <dl class="list2">
                                      Upstairs Registration:<br/>
                                      	<div style="margin-left:10px;">
	                                      	<?php echo getPrinterInfo('192.168.11.158', 'toner') ?><br/>
	                                      	<?php echo getPrinterInfo('192.168.11.158', 'paper') ?>
                                        </div><br/>
                                      Downstairs S-112:<br/>
                                      	<div style="margin-left:10px;">
	                                      	<?php echo getPrinterInfo('192.168.11.3', 'toner') ?><br/>
	                                      	<?php echo getPrinterInfo('192.168.11.3', 'paper') ?>
                                        </div>
                                    </dl>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <!-- box end -->
              
              <!-- box begin -->
              <div class="box alt">
                <div class="border-top">
                  <div class="border-right">
                    <div class="border-bot">
                      <div class="border-left">
                        <div class="left-top-corner">
                          <div class="right-top-corner">
                            <div class="right-bot-corner-1">
                              <div class="left-bot-corner-1">
                                <div class="inner" style="background-color:#FFF">
                                  <h3>Todays Staff</h3>
                                  <div class="inner">
                                    <dl class="list2">
                                      <dt>K-121</dt>
                                      <?php
									  $sql = "SELECT * FROM `tbEmployees` WHERE `sLocation` = 'K-121'";
									  $q = db::Query($sql);
									  while($row = $q->fetch()){
									  ?>
									  	<?php if($row['s'.date('D')] != ''){ ?>
                                        	<dd style="margin-left:15px;">
											<b><?php echo $row['sFname']." ".$row['sLname'] ?></b>
                                            <br/>
                                            <?php if($row['sOutTill'] > time()){ ?>
                                            	<?php echo "<font color='red'>Employee Called Out</font>" ?>
                                            <?php }else{ ?>
	                                            <?php echo $row['s'.date('D')]; ?>
                                            <?php } ?>
                                            </dd>
                                        <?php } ?>
									  <?php } ?>
                                      <dt>K-103</dt>
                                      <?php
									  $sql = "SELECT * FROM `tbEmployees` WHERE `sLocation` = 'K-103'";
									  $q = db::Query($sql);
									  while($row = $q->fetch()){
									  ?>
									  	<?php if($row['s'.date('D')] != ''){ ?>
                                        	<dd style="margin-left:15px;">
											<b><?php echo $row['sFname']." ".$row['sLname'] ?></b>
                                            <br/>
                                            <?php echo $row['s'.date('D')]; ?>
                                            </dd>
                                        <?php } ?>
									  <?php } ?>
                                    </dl>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <!-- box end -->
            </div>
            
          </div>
        </div>
        <div class="center">
          <div class="extra-wrap">
            <div class="wrapper">
              <div class="col-2"<?php if(!$CONFIG['enableRightColumn']){ ?> style="display:none"<?php } ?>>
              <!-- box begin -->
              <div class="box alt">
                <div class="border-top">
                  <div class="border-right">
                    <div class="border-bot">
                      <div class="border-left">
                        <div class="left-top-corner">
                          <div class="right-top-corner">
                            <div class="right-bot-corner-1">
                              <div class="left-bot-corner-1">
                                <div class="inner" style="background-color:#FFF">
                                  <h3>Todays Desktop Techs</h3>
                                  <div class="inner">
                                    <dl class="list2">
                                      <?php
									  $sql = "SELECT * FROM `tbTechs` ORDER BY `sTech` ASC";
									  $q = db::Query($sql);
									  while($row = $q->fetch()){
										  if($row['sExtension'] == ""){
									  	$row['sExtension'] = "N/A";
									  }
									  if($row['sNextel'] == ""){
									  	$row['sNextel'] = "N/A";
									  }
									  if($row['sEmail'] == ""){
									  	$row['sEmail'] = "N/A";
									  }
									  if((time() - $row['sLastCall']) > 899){
									  	$sStatus = '<font color="green">Avaliable For Call</font>';
									  }else{
									  	$sStatus = '<font color="red">Out On A Call - '.date("g:i A", $row['sLastCall']).'</font>';
									  }
									  if($row['sHours'.date("D")] == ""){
									  	$sStatus = '<font color="red">Off Shift</font>';
									  }else{
									  	$temp = explode("-", $row['sHours'.date("D")]);
									  	$sStart = $temp[0];
									  	$sEnd = $temp[1];
									  	$sStart = strtotime($sStart.":00 ".date("M j, Y"));
									  	$sEnd = strtotime($sEnd.":00 ".date("M j, Y"));
									  	if($sStart < time()){
									  		if($sEnd < time()){
									  			$sStatus = '<font color="red">Off Shift</font>';
									  		}
									  	}else{
									  		$sStatus = '<font color="red">Off Shift</font>';
									  	}
									  }
									  if($row['sOutTill'] != ""){
									  	if(time() < $row['sOutTill']){
									  		$sStatus = '<font color="red">Tech Called Out</font>';
									  	}
									  }
									  if($row['sProjectTill'] != ""){
									  	if(time() < $row['sProjectTill']){
									  		$sStatus = '<font color="red">Working On Project</font>';
									  	}
									  }
									  ?>
									  	<?php if($sStatus != '<font color="red">Off Shift</font>'){ ?>
                                        	<center>
                                        	<dd style="margin-left:0px;">
											<b><?php echo $row['sTech'] ?></b>
                                            <br/>
                                            <b><?php echo $sStatus ?></b>
                                            <br/>
                                            <?php if($sStatus == '<font color="red">Working On Project</font>'){ ?>
&nbsp;&nbsp;&nbsp;Project Ends 
<?php
if(date("n/j/Y", $row['sProjectTill']) == date("n/j/Y")){
	echo "Today @ ".date("g:i A", $row['sProjectTill']);
}elseif(date("n/j/Y", $row['sProjectTill']) == date("n/j/Y", strtotime("tomorrow"))){
	echo "Tomorrow @ ".date("n/j/Y @ g:i A", $row['sProjectTill']);
}else{
	echo date("n/j/Y @ g:i A", $row['sProjectTill']);
}
?><br/>
<?php } ?>
                                            <?php echo date("g A", $sStart)." - ".date("g A", $sEnd); ?>
                                            </dd>
                                            </center>
                                        <?php } ?>
									  <?php } ?>
                                    </dl>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <!-- box end -->
              </div>
              <div class="col-1" <?php if(!$CONFIG['enableRightColumn']){ ?> style="width:100%"<?php } ?>>
                <div class="extra-wrap">
                  <!-- box2 begin -->
                  <div class="box2">
                    <div class="border-top">
                      <div class="border-right">
                        <div class="border-bot">
                          <div class="border-left">
                            <div class="left-top-corner">
                              <div class="right-top-corner">
                                <div class="right-bot-corner">
                                  <div class="left-bot-corner">
                                    <div class="inner">
                                      <!-- title-box begin -->
                                      <div class="title-box" align="center"> <b>TITLE</b></div>
                                      <!-- title-box begin -->
                                      <div class="img-box">
                                      MAIN BOX
                                      </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <!-- box2 end -->
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
</html>